package com.ac.zhly.controller;

import com.ac.zhly.boot.result.R;
import com.ac.zhly.model.param.LoginParam;
import com.ac.zhly.model.vo.UserVO;
import com.ac.zhly.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/api/login")
public class LoginController {
    @Resource
    private UserService userService;

    @PostMapping
    public R login(@RequestBody LoginParam loginParam) {
        UserVO userVO = userService.getUserInfo(loginParam);
        if (userVO == null) {
            return R.failed("用户信息未找到");
        }
        return R.ok(userVO);
    }
}
